#include<stdio.h>
#include<math.h>

main()
{
	float norm(float);
	float pcdif(float,float);
	float normweght(float,float);
	void showit(float,float,float);
	
	int years,months;
	float height,normht,weight,normwt;
	float age,perdif;
	
	printf("How old is the child?\n");
	scanf("%d",&years);
	printf("How many month since the child's birthday?\n");
	scanf("%d",&months);
	age=years+months/12.0;
	printf("Enter the child's height(in inches):\n");
	scanf("%f",&height);
	printf("Enter the child's weight(in pounds):\n");
	scanf("%f",&weight);
	
	normht=norm(age);
	
	perdif=pcdif(height,normht);
	
	normwt=normweght(age,weight);
	
	showit(normht,perdif,normwt);
	
	
	
	return 0;
}

float norm(float age)
{
	#define MINAGE 6.0
	float agedif,avght;
	
	agedif=age-MINAGE;
	avght=-0.25*pow(agedif,2)+3.5*agedif+45.0;
	return(avght);
}

float normweght(float age,float weight)
{
	#define MINAGE 6.0
	float agedif,normweight;
	agedif=age-MINAGE;
	normweight=0.5*(agedif)+5.0*(agedif)+48;
	return(normweight);
} 

float pcdif(float actual,float base)
{
	return (actual-base)/base*100.0;
}

void showit(float normht,float perdif,float normwt)
{
	printf("\nThe average height in inches is:%5.2f\n",normht);
	printf("The actual height deviated from the norm by:%6.2f%c\n",perdif,'%');
	printf("The actual weight deviated from the norm by:%6.2f%c\n",normwt,'%');
}


